package com.ruoyi.project.system.house.member.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.house.house.enums.HouseDto;
import com.ruoyi.project.system.house.member.mapper.MemberHouseMapper;
import com.ruoyi.project.system.house.member.domain.MemberHouse;
import com.ruoyi.project.system.house.member.service.IMemberHouseService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 用户收藏Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-29
 */
@Service
public class MemberHouseServiceImpl implements IMemberHouseService 
{
    @Resource
    private IdGererateFactory idGererateFactory;

    @Autowired
    private MemberHouseMapper memberHouseMapper;

    /**
     * 查询用户收藏
     * 
     * @param id 用户收藏ID
     * @return 用户收藏
     */
    @Override
    public MemberHouse selectMemberHouseById(String id)
    {
        return memberHouseMapper.selectMemberHouseById(id);
    }

    /**
     * 查询用户收藏列表
     * 
     * @param memberHouse 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<MemberHouse> selectMemberHouseList(MemberHouse memberHouse)
    {
        return memberHouseMapper.selectMemberHouseList(memberHouse);
    }

    /**
     * 新增用户收藏
     * 
     * @param memberHouse 用户收藏
     * @return 结果
     */
    @Override
    public int insertMemberHouse(MemberHouse memberHouse)
    {
        memberHouse.setId(this.idGererateFactory.nextStringId());
        return memberHouseMapper.insertMemberHouse(memberHouse);
    }

    /**
     * 修改用户收藏
     * 
     * @param memberHouse 用户收藏
     * @return 结果
     */
    @Override
    public int updateMemberHouse(MemberHouse memberHouse)
    {
        return memberHouseMapper.updateMemberHouse(memberHouse);
    }

    /**
     * 删除用户收藏对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberHouseByIds(String ids)
    {
        return memberHouseMapper.deleteMemberHouseByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户收藏信息
     * 
     * @param id 用户收藏ID
     * @return 结果
     */
    @Override
    public int deleteMemberHouseById(String id)
    {
        return memberHouseMapper.deleteMemberHouseById(id);
    }

    @Override
    public List<HouseDto> findListByUid(String uid) {
        return this.memberHouseMapper.findListByUid(uid);
    }
}
